package com.example.dllo.baidumusic.fragment;
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         佛祖保佑       永无BUG
*/

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.dllo.baidumusic.R;
import com.example.dllo.baidumusic.bean.MusicBean;
import com.example.dllo.baidumusic.events.SingInfoEvent;
import com.example.dllo.baidumusic.bean.MusicBeanListBean;
import com.example.dllo.baidumusic.nettool.BaseFragment;
import com.example.dllo.baidumusic.nettool.NetTool;
import com.litesuits.orm.LiteOrm;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.List;

import cn.bmob.v3.BmobUser;

/**
 * Created by dllo on 16/8/27.
 */
public class PicFragment extends BaseFragment implements View.OnClickListener {
    private ImageView pic;
    private NetTool netTool;
    private CheckBox like;
    private String urlSing;
    private TextView singUrl;
    private TextView singer;
    private TextView singName;
    private List<MusicBean> musicBeanList;
    private int position;
    private LiteOrm liteOrm;
    private BmobUser bmobUser;

    @Override
    protected int setLayout() {
        return R.layout.fragment_playingpic;
    }

    @Override
    protected void initView() {

        pic = bindView(R.id.playing_pic);

    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EventBus.getDefault().register(this);
        EventBus.getDefault().post(new SingInfoEvent());
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void getMusicInfo(MusicBean musicBean) {
        NetTool netTool = new NetTool();
        netTool.getImage(musicBean.getBigpic(), pic);

    }


    @Subscribe(threadMode = ThreadMode.MAIN)
    public void getMusicDeatil2(MusicBeanListBean musicBeanListBean) {
        musicBeanList = musicBeanListBean.getMusicBeen();
        position = musicBeanListBean.getPosition();
        urlSing = musicBeanList.get(position).getUrl();
        netTool = new NetTool();
        netTool.getImage(musicBeanList.get(position).getBigpic(), pic);
    }

    @Override
    protected void initData() {

    }

    @Override
    public void onClick(View v) {


    }
}
